<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //0.Number.EPSILON 是js表示的最小精度 
        function equal(a, b) {
            if (Math.abs(a - b) < Number.EPSILON) {
                return true;
            } else {
                return false;
            }
        }
        // console.log(0.1 + 0.2 === 0.3);
        // console.log(equal(0.1 + 0.2, 0.3));
        //1.二进制和八进制
        let b = 0b1010; //二进制 0b开头
        let o = 0o777; //八进制 0o开头
        let d = 100;
        let x = 0xff; //十六进制0x开头
        console.log(x);
        //2.Number.isFinite()检测一个数值是否为有限数
        console.log(Number.isFinite(100)); //打印true
        console.log(Number.isFinite(100 / 0)); //打印false
        console.log(Number.isFinite(Infinity)); //无穷  打印true
        //3.Number.isNaN() 检测一个数值是否为NaN
        console.log(Number.isNaN(123)); //打印false
        //4.Number.parseInt    Number.parseFloat 字符串转整数
        console.log(Number.parseInt("1243242cvnsdk")); //打印1243242
        console.log(Number.parseFloat("423.34243计划")); //会截断，只取数字  打印423.34243
        //5.Number.isInteger  判断一个数是否为整数
        console.log(Number.isInteger(5324.4)); //打印false
        //6. Math.trunc 将数字的小数部分抹掉
        console.log(Math.trunc(3.5)); //打印3
        //7. Math.sign 判断一个数是正数，负数还是零
        console.log(Math.sign(100)); //打印1
        console.log(Math.sign(0)); //打印0
        console.log(Math.sign(-2432)); //打印-1
    </script>
</body>

</html>